package com.bdqn.ch06.controller;


import com.bdqn.ch06.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping(value = "/list")
    public String list(Model model) {
        List<User> list = new ArrayList<>();
        User user1 = new User();
        user1.setUsrId(1L);
        user1.setUsrName("aa");
        User user2 = new User();
        user2.setUsrId(2L);
        user2.setUsrName("bb");
        list.add(user1);
        list.add(user2);
        model.addAttribute("list", list);
        return "user/list";
    }
}
